package com.atguigu.orderservice.controller;


import com.atguigu.commonutils.R;
import com.atguigu.orderservice.service.TPayLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 支付日志表 前端控制器
 * </p>
 *
 * @author huangqicai
 * @since 2023-04-01
 */
@Api(value = "微信支付")
//原来需要在Controller上面加上@CrossOrigin解决跨域问题，现在gateway已经处理了
@RestController
@RequestMapping("/orderservice")/*这里是需要写成orderservice的，因为在nginx里面是写的这个*/
public class TPayLogController {

    @Autowired
    private TPayLogService payLogService;

    @ApiOperation(value = "根据订单id生成微信支付二维码")
    @GetMapping("/createNative/{orderId}")
    public R createNative(@PathVariable(value = "orderId") String orderId){
        return payLogService.createNative(orderId);
    }


    @ApiOperation(value = "根据订单idNo获取支付状态")
    @GetMapping("/queryPayStatus/{orderNo}")
    public R queryPayStatus(@PathVariable(value = "orderNo") String orderNo){
        return payLogService.queryPayStatus(orderNo);
    }

}

